﻿using System;
using Topshelf;

namespace ResharperLicenseService
{
    internal class Program
    {
        public static void Main()
        {
            HostFactory.Run(x =>
            {
                try
                {
                    x.SetDescription("resharper授权服务"); //设置服务显示备注
                    x.SetDisplayName("resharper授权服务"); //设置服务显示名称
                    x.SetServiceName("ResharperLicenseService"); //服务名称
                    x.Service<LicenseService>(); //设置启动类
                    x.RunAsLocalSystem(); //使用本地系统用户
                    x.EnableShutdown(); //允许关闭
                    x.EnablePauseAndContinue(); //允许暂停和继续
                    x.StartAutomaticallyDelayed(); //延迟启动
                    x.OnException(Console.WriteLine
                    ); //全局错误回调
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    Console.ReadLine();
                }
            });
        }
    }
}